<?php

namespace app\modules\api\helper;

use Yii;

class Error
{
    const OK          = 0;
    const INTERNAL    = 1;
    const UNKNOW      = 2;
    const PARAM       = 10001;
    const PARAM_EMPTY = 10002;
    const DATA        = 20001;

    protected static $msg = [
        self::OK            => 'ok',
        self::INTERNAL      => 'internal',
        self::UNKNOW        => 'unknow',
        self::DATA          => 'data',
        self::PARAM         => 'param',
        self::PARAM_EMPTY   => 'param empty',
    ];

    public static function msg($idx)
    {
        if (self::$msg[$idx]) {
            return Yii::t('api', self::$msg[$idx]);
        }
        return false;
    }
}
